package me.keiwu.pub.rpc;

import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Created by kei on 26/11/2017.
 */
public interface ChallengeRpcPub {


    @Async
    @RequestMapping("/rpc/challenge/step/update/trigger")
    void triggerUpdateStep(@RequestParam("userId") Long userId);

    @RequestMapping("/rpc/challenge/list")
    String listChallenges(@RequestParam("state") Integer state,
                         @RequestParam("afterDate") String afterDate,
                         @RequestParam("beforeDate") String beforeDate,
                         @RequestParam("name") String name,
                         @RequestParam("page") Integer page,
                         @RequestParam("size") Integer size);

    @RequestMapping("/rpc/challenge/list/starting")
    String listStartingChallenges(@RequestParam("page") Integer page,
                         @RequestParam("size") Integer size);

    @RequestMapping("/rpc/challenge/close")
    Integer closeChallenge(@RequestParam("challengeId") Long challengeId);

    @RequestMapping("/rpc/challenge/reopen")
    Integer reopenChallenge(@RequestParam("challengeId") Long challengeId);


    @RequestMapping("/rpc/challenge/findChallengeById")
    String findAllUserChallenge(@RequestParam("challengeId") Long challengeId);

    @RequestMapping("/rpc/challenge/list/user")
    String findAllUserChallenge(@RequestParam("userId") Long userId,
                                @RequestParam("page") Integer page,
                                @RequestParam("size") Integer size);

    @RequestMapping("/rpc/challenge/yesterdayChallenges")
    String yesterdayChallenges(@RequestParam("page") Integer page,
                                @RequestParam("size") Integer size);


}
